package com.tx.utils;

import io.swagger.annotations.ApiModelProperty;

/**
 * @author pyl
 * @date 2019/11/1
 * description
 **/
public class WsResult {

    @ApiModelProperty(value = "code", example = "1000：成功，2000：失败")
    private Integer code;

    @ApiModelProperty(value = "描述")
    private String message;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public static final class Builder<T> {
        private Integer code;
        private String message;
        private Long timestamp;
        private T data;

        private Builder() {
        }

        public static WsResult.Builder aResult() {
            return new WsResult.Builder();
        }

        public WsResult.Builder withCode(Integer code) {
            this.code = code;
            return this;
        }

        public WsResult.Builder withMessage(String message) {
            this.message = message;
            return this;
        }

        public WsResult build() {
            WsResult result = new WsResult();
            result.setCode(code);
            result.setMessage(message);
            return result;
        }
    }
}
